package com.shipxpress.register.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.shipxpress.SessionManager;
import com.shipxpress.register.model.UserList;
import com.shipxpress.register.view.UserListForm;

public class DisplayRegistrationAction extends Action{
    @Override
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception {
        UserList userList = SessionManager.getSessionUserList(request.getSession());

        // I didn't set this user list form to session.. struts did
        UserListForm listForm = SessionManager.getSessionUserListForm(request.getSession());
        listForm.setUserList(userList);

        //I do not need to set this to session also
        //SessionManager.setUserListForm(request.getSession(), listForm);
        return mapping.findForward("success");
    }
}
